<template>
	<view style="background-color: rgb(247,247,247);">
		<view class="" v-show="page">
			<view class="top_navigation">
				<u-navbar title="首页" :bgColor="bgColor" :titleStyle='titleStyle' placeholder=true>
					<view class="u-nav-slot" slot="left" @click="personal">
						<u-icon name="person-delete-fill" size="25" color='#E3F7F0'>
						</u-icon>
					</view>
				</u-navbar>
				<!-- 服务数据 -->
				<view class="service_data">
					<view class="service_data_text">
						<p class="service_data_text_num">{{ServiceScore}}</p>
						<span>服务分</span>
					</view>
					<view class="service_data_text">
						<p class="service_data_text_num">{{sum}}</p>
						<span>今日流水</span>
					</view>
					<view class="service_data_text">
						<p class="service_data_text_num">{{orderNum}}</p>
						<span>今日接单数</span>
					</view>
					<view class="service_data_text">
						<p class="service_data_text_num">{{accountState}}</p>
						<span>当前状态</span>
					</view>
				</view>
				<!-- 功能按钮 -->
				<view class="function">
					<view class="function_btn">
						<u-button customStyle="color:black" icon="list" text="选单" color="rgb(242,242,242)"></u-button>
					</view>
					<view class="function_btn">
						<u-button customStyle="color:black" icon="gift" text="奖励" color="rgb(242,242,242)"></u-button>
					</view>
					<view class="function_btn">
						<u-button customStyle="color:black" icon="map" text="热力图" color="rgb(242,242,242)"></u-button>
					</view>
					<view class="function_btn">
						<u-button customStyle="color:black" text="更多" color="rgb(242,242,242)"></u-button>
					</view>
				</view>
				<!-- 中间内容 -->
				<view class="promote">
					<!-- 标题 -->
					<view class="promote_title">
						<view class="promote_text">
							<view style="font-size: 20px;font-weight: 700;">如何提升服务分？</view>
							<text>小滴课堂来帮您，快来学习吧</text>
						</view>
					</view>
					<view class="promote_skip">
						<view>去学习</view>
						<view @click="explain">
							<u-icon name="arrow-right-double" size="28"></u-icon>
						</view>
					</view>
				</view>
				<!-- 底部按钮 -->
				<view class="bottom_btn">
					<view class="btn_pattern">
						<u-button customStyle="color:white" :text="present" color="rgb(90,97,113)">{{present}}
						</u-button>
					</view>
					<view class="btn_depart">
						<u-button customStyle="color:white" text="点击出车" color="rgb(254,93,14)" @click="pop_Up">
						</u-button>
					</view>
				</view>
				<view>
				</view>

				<u-picker :show="show" :columns="columns" @confirm='patternCut'></u-picker>
			</view>
		</view>
		<!-- 对我的评价 -->
		<view class="" v-show="complaintttt">
			<view>
				<u-navbar title="我的投诉" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style="margin-top: 80px;">

			</view>
			<view class="u-page" v-for="(item,index) in userlist" :key="index">
				<view class="" style="display: flex; height: 50px;  margin-top: 20px;">
					<view class="" style="margin-left: 10px;">
						<u-avatar :src=item.headPortrait shape="circle"></u-avatar>
					</view>
					<view class="" style="line-height: 30px; margin-left: 10px;">
						{{item.wxName}}
					</view>
					<view class="" style="line-height: 30px; margin-left: 10px; font-size: 13px;">
						{{item.establishTime}}
					</view>
				</view>

				<view class="" style="height: 60px;  ">
					<view class="" style="margin-left: 20px;">
						{{item.commentContent}}
					</view>
				</view>
				<view class="" style="display: flex; margin-top: 10px;border: 1px solid whitesmoke;">
					<view class="" style="width: 20%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="star" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 25%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="chat" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 25%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="thumb-up" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 30%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="heart" size="20"></u-icon>
						</view>

					</view>
				</view>


			</view>
			<view class="" style="height: 30px;">

			</view>
		</view>
		<!-- 司机个人首页 -->
		<view class="">
			<u-popup :show="showw" mode="left" @close="close" @open="open">
				<view class="" v-if="driverid!=''">
					<view v-for="(item,index) in pagelist" :key="index">
						<view class="" style="display: flex; margin-top: 30px; ">
							<view class="" style=" margin-left: 5px; ">
								<u-avatar :src="item.driverPhoto"></u-avatar>
							</view>

							<view class="" style="margin-top: 2%; margin-left: 20px;">
								{{item.driverName}}
							</view>
						</view>
						<view class=""></view>
					</view>

				</view>
				<view v-else class="" style="margin-top: 30px;">
					<view class="" style="margin-left: 35%;">
						<u-avatar :src=src shape="circle"></u-avatar>
					</view>
					<view class="" style="width: 30%; margin-left: 27%; margin-top: 10px;">
						<u-button @click="login" text="去登录"></u-button>
					</view>

				</view>
				<view class="" style="margin-top: 30px; width: 280px;">
					<u-cell @click="orderr" icon="car" title="我的行程"></u-cell>
					<u-cell @click="qianbao" icon="rmb-circle" title="我的钱包"></u-cell>
					<u-cell @click="yinh" icon="coupon" title="我的银行卡"></u-cell>
					<u-cell @click="carxi" icon="level" title="我的车辆信息"></u-cell>
					<u-cell @click="evaluation" icon="chat" title="给我的评价"></u-cell>
					<u-cell @click="mmycomplaint" icon="chat" title="我的投诉"></u-cell>
					<u-cell @click="centerr" icon="setting-fill" title="设置"></u-cell>
					<u-cell @click="Chat" icon="chat" title="联系客服"></u-cell>
				</view>
			</u-popup>
		</view>
		<!-- 司机订单 -->
		<view class="" v-show="order">
			<view class="">
				<u-navbar title="我的订单" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style="margin-top: 70px;">

			</view>
			<view class="" v-show="item.state==8 || item.state==9" v-for="(item,index) in driverlist" :key="index"
				style=" border: 1px solid #9a9998; background-color: #767a82; border-radius: 10px; width: 90%; margin: 0% auto;height: 160px; margin-top: 20px;">
				<view class="">
					<view class="" style="display: flex; height: 25px; margin-top: 13px;">
						<view class="" style="margin-left: 10px; margin-top: 1%;">
							<u-icon name="clock" color="white" size="20"></u-icon>
						</view>
						<view class="" style=" font-size: 12px; color: white; margin-top: 5px;">
							{{item.creationtime}}
						</view>
						<view class=""
							style=" text-align: center;border: 1px solid black;   width: 60px; border-radius: 10px; margin-left: 5px;">
							实时
						</view>
						<view class="" style="color: white; margin-left: 5px;">
							<view v-if="item.state==9" class="">
								已完成
							</view>
							<view v-else class="">
								已被取消
							</view>
						</view>
					</view>
					<view class="" style="margin-top: 10px; display: flex;">
						<view class="" style="margin-left: 10px;margin-top: 2%;">
							<u-badge :isDot="true" type="success"></u-badge>
						</view>
						<view class="" style="margin-left: 10px;color: white;font-size: 13px;">{{item.destination}}
						</view>
					</view>
					<view class="" style="margin-top: 10px; display: flex;">
						<view class="" style="margin-left: 10px; margin-top: 2%;">
							<u-badge :isDot="true" type="success"></u-badge>
						</view>
						<view class="" style="margin-left: 10px;color: white;font-size: 13px;">
							{{item.departure}}
						</view>

					</view>
					<view class="">
						<view class="" v-if="item.state==9" style="width: 15%; margin-left: 60%; margin-top: 10px;">
							<u-button type="primary" @click="toshu(item)" text="投诉"></u-button>
						</view>
					</view>
				</view>
			</view>
			<!-- 投诉 -->

			<view class="">
				<u-popup :show="complaints" mode="center" @close="close" @open="open">
					<view class="" style="height: 180px; width: 300px; margin-top: 5px;">
						<u--textarea v-model="value2" height=110 placeholder="请输入投诉的内容" count></u--textarea>
						<view class="" style="margin: 0% auto; width: 80%; margin-top: 5px;">
							<u-button @click="dispatch" :disabled="disabled" type="primary" text="发送"></u-button>
						</view>

					</view>
				</u-popup>
			</view>
			<view class="" style="height: 30px;">

			</view>
		</view>
		<!-- 钱包 -->
		<view class="">
			<view v-show="qian">
				<view>
					<u-navbar title="我的钱包" @leftClick="leftClick">
					</u-navbar>
				</view>
				<view>
					<view class="" style="margin-top: 80px; width: 15%; height: 20%; margin-left: 80%;">
						<u-button @click="water" text="钱包流水"></u-button>
					</view>
					<view class="aa">

					</view>
					<view class="bb">
						<view v-for="(item,index) in pagelist" :key="index" class="" style="margin-top: 20px;">
							余额：<span style="color: red; font-size: 20px;">{{item.money}}</span>
						</view>
						<view class=""
							style="border: 1px solid black; border-radius: 6px; width: 60%; margin: 0% auto; height: 30px; margin-top: 30px; ">
							<input type="text" v-model="valuee" placeholder="请输入金额">
						</view>
						<view class="" style=" width: 50%; margin: 0% auto; margin-top: 40px;">
							<u-button @click="recharge" :disabled="disabled" style="width: 20%;" type="primary"
								text="提现"></u-button>
						</view>
					</view>
				</view>
			</view>
			<!-- 钱包流水 -->
			<view class="" v-show="monetdebt">
				<view>
					<u-navbar title="我的钱包流水" @leftClick="leftClick">
					</u-navbar>
				</view>
				<view class="" style="margin-top: 80px;">
				</view>
				<view style="display: flex;height: 60px;border-bottom: 1px solid black; margin-top: 10px;"
					v-for="(item,index) in withdrawallist " :key="index">
					<view class="" style="width:20%;margin-left: 5%;">
						<!-- <u-avatar  :src=i.driverPhoto shape="circle"></u-avatar> -->
					</view>
					<view class="" style="width: 80%;">
						<view class="">银行提现<span style="margin-left: 55%;">+{{item.withdrawalnumber}}</span></view>
						<view class="" style="margin-top: 10px; font-size: 11px;">{{item.time}} </view>
					</view>
				</view>
			</view>
		</view>
		<!-- 我的投诉 -->
		<view class="" v-show="mycomplaint">
			<view>
				<u-navbar title="我的投诉" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style="margin-top: 80px;">

			</view>
			<view class="u-page" v-for="(item,index) in totos" :key="index">
				<view class="" style="display: flex; height: 50px;  margin-top: 20px;">
					<view class="" style="margin-left: 10px;">
						<u-avatar :src=item.headPortrait shape="circle"></u-avatar>
					</view>
					<view class="" style="line-height: 30px; margin-left: 10px;">
						{{item.wxName}}
					</view>
					<view class="" style="line-height: 30px; margin-left: 10px; font-size: 13px;">
						{{item.time}}
					</view>
				</view>

				<view class="" style="height: 60px;  ">
					<view class="" style="margin-left: 20px;">
						{{item.centen}}
					</view>
				</view>
				<view class="" style="display: flex; margin-top: 10px;border: 1px solid whitesmoke;">
					<view class="" style="width: 20%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="star" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 25%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="chat" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 25%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="thumb-up" size="20"></u-icon>
						</view>

					</view>
					<view class="" style="width: 30%;">
						<view class="" style="margin-left: 20px;">
							<u-icon name="heart" size="20"></u-icon>
						</view>

					</view>
				</view>


			</view>
		</view>
		<!-- 我的车辆 -->
		<view class="" v-show="mycar" v-for="(item,index) in carlist" :key="index">
			<view>
				<u-navbar title="我的车辆信息" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style="margin-top: 100px;">
				<u-cell title="车辆号码" :value="item.plateNumber"></u-cell>
				<u-cell title="车辆所有人" :value="item.driverName"></u-cell>
				<u-cell title="车辆品牌" :value="item.brand"></u-cell>
				<u-cell title="注册日期" :value="item.establishTime"></u-cell>
				<u-cell title="车辆颜色" :value="item.Colour"></u-cell>
				<u-cell title="车辆座位数" :value="item.loadNum"></u-cell>
			</view>
		</view>
		<!-- 司机个人中心 -->
		<view class="" v-show="center" style="margin-top: 60px;" v-for="(item,index) in pagelist" :key="index">
			<view class="">
				<u-navbar title="我的个人中心" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style="margin-left: 40%; margin-top: 30px;">
				<u-avatar style="margin: 0% auto;" :src="item.driverPhoto"></u-avatar>
			</view>
			<view class="">
				<u-cell title="昵称" :isLink="false" :value="item.driverName"></u-cell>
				<u-cell title="性别" :isLink="false" :value="item.driverSex"></u-cell>
				<u-cell title="手机号" :isLink="false" :value="item.phoneNumber "></u-cell>
				<u-cell title="注册时间" :isLink="false" :value="item.creationTime"></u-cell>
				<u-cell title="身份号码" :isLink="false" :value="item.driverCard | hideMiddle"></u-cell>
				<u-cell title="信誉分" :isLink="false" :value="item.CreditPoints"></u-cell>
				<u-cell title="用户邮箱" :isLink="false" :value="item.driverMailbox"></u-cell>
				<u-cell @click="imggg" title="修改头像" :isLink="true"></u-cell>
				<!-- <u-cell  @click="updatepwd" title="修改密码" :isLink="true" arrow-direction="right"></u-cell> -->
				<u-cell @click="updaphone" title="修改手机号" :isLink="true" arrow-direction="right"></u-cell>
				<u-button @click="tuichu" type="primary" text="退出登录"></u-button>
			</view>
		</view>
		<!-- 修改密码 -->
		<!-- <view class="content" v-show="uppwd">
				<view><input id="app" type="text" style="color: white;" v-model="acc" placeholder="请输入原密码"></view>
				<view><input id="app" style="color: white;" type="password" v-model="pwd" placeholder="请输入新密码"></view>
				<view><input id="app" style="color: white;" type="password" v-model="qrpwd" placeholder="确认密码"></view>
				<view id="input" style="margin-top: 20px; color: aqua;">
					<view class="" style="display: flex;">
						<button   @click="update">点击修改</button>
						<button style="margin-left: 20px;" @click="cancel">取消修改</button>
					</view>
					
				</view>
			</view> -->
		<!-- 修改手机号码 -->
		<view class="content" v-show="upphone">
			<view><input id="app" style="color: white;" type="text" v-model="phone" placeholder="请输入原手机号码"></view>
			<view><input id="app" style="color: white;" type="text" v-model="xinphone" placeholder="请输入新手机号码"></view>
			<view class="" style="display: flex; margin-top: 10px;">
				<view class="" style="width: 100px; border: 1px solid white;">
					<input style="color: white;" type="text" v-model="yzmvalues" placeholder="请输入验证码">
				</view>
				<view class="" style="width: 50%; margin-left: 1%; line-height: 40px;">
					<u-toast ref="uToast"></u-toast>
					<u-code :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-code>
					<u-button @tap="getCode">{{tips}}</u-button>
				</view>

			</view>
			<view class="" style="display: flex; margin-top: 30px;">
				<button @click="updatephone">点击修改</button>
				<button style="margin-left: 20px;" @click="cancelphone">取消修改</button>
			</view>
		</view>
		<!-- 修改头像 -->
		<view class="" v-show="img">
			<view class="">
				<u-navbar title="修改头像" :autoBack="true" @leftClick="leftClick">
				</u-navbar>
			</view>
			<view class="" style=" margin: 0% auto;margin-top: 80px; margin-left: 29%; ">
				<u-upload width="300rpx" height="300rpx" :fileList="fileList1" @afterRead="afterRead"
					@delete="deletePic" name="1" multiple :maxCount="1" :previewFullImage="true"></u-upload>
			</view>
			<u-button type="primary" @click="imgg" text="确定" customStyle="width:90%;margin-top:10px;"></u-button>

		</view>
		<!-- 银行卡 -->
		<view class="">
			<view class="" v-show="bank">
				<view class="" v-if="mybank">
					<view class="">
						<u-navbar title="我的银行卡" @leftClick="leftClick">
						</u-navbar>
					</view>
					<view
						style="background-image: url(../../static/jianc.webp); height: 150px; margin-top: 100px; width: 90%; margin-left: 5%;">
						<view class="" style="height: 100px;">

						</view>
						<view class="" style="margin-left: 7%; font-size: 20px; color:white;">
							{{mybank | hideMiddle}}
						</view>
					</view>
					<view class="">
						<u-button type="primary" @click="jiabank" text="添加银行卡" customStyle="width:90%;margin-top:10px;">
						</u-button>
					</view>
					<view class="">
						<u-button type="primary" @click="delbank" text="删除银行卡" customStyle="width:90%;margin-top:10px;">
						</u-button>
					</view>
				</view>
				<view class="" v-else style="margin-top: 60px;">
					<view class="">
						<u-navbar title="我的银行卡" @leftClick="leftClick">
						</u-navbar>
					</view>
					<u-button type="primary" @click="jiabank" text="添加银行卡" customStyle="width:90%;margin-top:10px;">
					</u-button>
				</view>

				<!-- 添加银行卡 -->
				<view class="" v-show="intobank" style="width: 90%; margin: 0% auto; margin-top: 30px;">
					<u--input v-model="bankvalue" placeholder="请输入你的银行卡" border="surround" clearable></u--input>
					<view class="">
						<u-button type="primary" @click="initvalue" text="确定添加"
							customStyle="width:90%;margin-top:10px;"></u-button>
					</view>
				</view>
				<!-- 删除银行卡 -->
				<view class="" v-show="delmybank" style="width: 90%; margin: 0% auto; margin-top: 30px;">
					<view class="">
						<u--input v-model="bankvalue" placeholder="请输入你的银行卡" border="surround" clearable></u--input>
					</view>
					<view class="">
						<u--input v-model="mypwd" placeholder="请输入用户密码" border="surround" clearable></u--input>
					</view>
					<view class="">
						<u-button type="primary" @click="delvalue" text="确定删除" customStyle="width:90%;margin-top:10px;">
						</u-button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				totos: [], //我的投诉表
				mycomplaint: false,
				value2: '', //投诉的内容
				matter: [], //投诉表
				complaints: false,
				DriveruserTable: [], //新缓存数据
				yzmvalues: '', //输入的验证码
				tips: '',
				seconds: 60, //验证码时间
				yzm: '', //验证码
				withdrawallist: [], //提现表
				monetdebt: false, //钱包账单页面
				laundrylist: [], //钱包流水账单
				userlist: [], //用户信息
				complaintttt: false, //评论页面
				aaaaaa: [],
				driverlist: [], //司机表
				driverid: '', //司机id
				carlist: [], //车辆信息表
				carId: '',
				mycar: false,
				upbank: '', //删除后银行卡的为空
				mypwd: '', //删除银行卡输的密码
				delmybank: false, //显示删除银行卡
				mymoney: '', //我的钱
				mybank: '', //我的银行卡
				bankvalue: '', //输入银行卡的值
				intobank: false, //显示添加银行卡
				bank: false, //显示银行卡
				tu: '', //添加图片的路劲
				fileList1: [], //图片列表
				img: false, //显示添加图片
				valuee: '', //银行卡提现输入的金额
				qian: false, //显示钱包
				phone: '', //输入原手机号码的值
				xinphone: '', //输入新手机号码的值
				upphone: false, //修改电话号码的弹框
				uppwd: false, //显示修改密码
				useracc: '123', //原密码
				acc: '', //输入的原密码
				pwd: '', //密码
				qrpwd: '', //确定密码
				center: false, //个人中心
				page: true, //首页
				order: false, //订单
				pagelist: [], //司机个人信息
				userr: '', //司机手机号
				showw: false, //司机中心
				bgColor: '#3E4460', //导航栏背景颜色
				titleStyle: { //导航栏字体颜色
					color: '#E3F7F0'
				},
				show: false, //模式点击时弹出
				columns: [ //选项
					['快车', '出租车']
				],
				present: '模式', //当前
				src: '../../static/didiLogo.jfif', //默认头像
				nowtime: '', //当前时间
				ServiceScore: '', //服务分
				accountState: '', //账号状态
				sum: 0, //今日流水
				orderNum: 0, //今日订单量
			}
		},
		methods: {
			Chat() {
				let userChat = {
					userId: '客服',
					UserFace: '',
					userName: '客服',
					chat: '客服'
				}
				uni.setStorageSync('userChat',userChat)
				console.log(userChat,1455)
				uni.navigateTo({
					url: "/pages/chat/chat"
				})
			},
			mmycomplaint() {
				if (this.userr != undefined) {
					this.mycomplaint = true
					this.page = false
					this.showw = false
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			//投诉
			dispatch() {
				console.log(1)
				console.log(this.value2, 539)
				this.matter = uni.getStorageSync("toshu")
				if (this.value2 != '') {
					let that = this
					uni.request({
						url: "http://localhost:8000/complainss",
						data: {
							user: that.matter.userId,
							drive: that.matter.driverId,
							value: that.value2,
							order: that.matter.orderId
						},
						method: 'GET',
						success: function(e) {
							console.log(e, 999)
							uni.showModal({
								title: '投诉成功',
								showCancel: false,
							});
							that.complaints = false
							that.value2 = ''
							that.centerrr()
						},
						fail: function(err) {
							console.log(err)
						},
					})
				} else {
					uni.showModal({
						title: '不能为空',
						showCancel: false,
					})
				}
			},
			//投诉
			toshu(i) {
				console.log(i)
				this.complaints = true
				uni.setStorageSync("toshu", i)
			},
			codeChange(text) {
				this.tips = text;
			},
			getCode() {
				if (this.$refs.uCode.canGetCode) {
					// 模拟向后端请求验证码
					uni.showLoading({
						title: '正在获取验证码'
					})
					setTimeout(() => {
						uni.hideLoading();
						uni.$u.toast('验证码已发送');
						this.$refs.uCode.start();
						this.fsyzm()
					}, 2000);
				} else {
					uni.$u.toast('倒计时结束后再发送');
					this.fsyzm()
				}
			},
			end() {
				uni.$u.toast('倒计时结束');
			},
			start() {
				uni.$u.toast('倒计时开始');
			},
			//发送验证码
			fsyzm() {
				console.log(1)
				let that = this
				uni.request({
					url: "http://localhost:8000/didiyzm",
					data: {
						phone: that.phone
					},
					method: 'GET',
					success: function(e) {
						console.log(that.phone, 510)
						console.log(e.data.data, 511)
						that.yzm = e.data.data
						uni.showModal({
							title: '发送验证码成功',
							showCancel: false,
						});
					},
					fail: function(err) {
						console.log(err)
					},
				})
			},
			//去登录
			login() {
				uni.navigateTo({
					url: '/pages/DriverLogin/DriverLogin'
				});
			},
			//点击显示钱包流水
			water() {
				this.qian = false
				this.monetdebt = true
			},

			// 获取司机车辆类型
			query() {
				var that = this
				var DriveruserTable = uni.getStorageSync('DriveruserTable')
				var phoneNumber = DriveruserTable.userTel
				// var phoneNumber = 15059226334
				uni.request({
					url: 'http://localhost:8000/serviceType',
					data: {
						phoneNumber: phoneNumber
					},
					method: 'GET', //get是默认 可以省略
					dataType: 'json', //json也是默认 可以不写
					success: function(res) {
						console.log(res.data.data[0].serviceType, 75);
						that.present = res.data.data[0].serviceType
					}
				})
			},
			// 日期转换
			getCurrentTimeStr(time) {
				var date = new Date(time);
				var time3 = Date.parse(date)
				// console.log(time3)
				var oDate = new Date(time3)
				var oYear = oDate.getFullYear()
				var oMonth = oDate.getMonth() + 1
				var oDay = oDate.getDate()
				var oTime = oYear + '-' + (oMonth) + '-' + (oDay)
				return oTime;
			},
			// 当前日期
			nowTimeStr() {
				var oDate = new Date(),
					oYear = oDate.getFullYear(),
					oMonth = oDate.getMonth() + 1,
					oDay = oDate.getDate(),
					oTime = oYear + '-' + (oMonth) + '-' + (oDay)
				return oTime;
			},
			// 首页司机个人信息
			myinfo() {
				var that = this
				var DriveruserTable = uni.getStorageSync('DriveruserTable')
				var phoneNumber = DriveruserTable.userTel
				var driverId = DriveruserTable.userId
				// var phoneNumber = 13023983059
				// var driverId = 9
				uni.request({
					url: 'http://localhost:8000/serviceinfo',
					data: {
						phoneNumber: phoneNumber
					},
					method: 'GET', //get是默认 可以省略
					dataType: 'json', //json也是默认 可以不写
					success: function(res) {
						console.log(res.data.data[0], 415);
						that.ServiceScore = res.data.data[0].CreditPoints
						if (res.data.data[0].backgroundState == '3') {
							that.accountState = '正常'
						} else if (res.data.data[0].backgroundState == '4') {
							that.accountState = '锁定'
						}
					}
				})
				uni.request({
					url: 'http://localhost:8000/servicemoney',
					data: {
						driverId: driverId
					},
					method: 'GET', //get是默认 可以省略
					dataType: 'json', //json也是默认 可以不写
					success: function(res) {
						// console.log(res.data.data,433);
						let nowTime = that.nowTimeStr() //当前日期
						res.data.data.forEach((item, index) => {
							// console.log(item,437)
							let orderTime = that.getCurrentTimeStr(item.creationtime) //订单日期
							console.log(nowTime, orderTime, 464)
							if (nowTime == orderTime) {
								that.sum += item.price
								that.orderNum += 1
							}
						})
					}
				})
			},
			//我的评价
			evaluation() {
				if (this.userr != undefined) {
					this.complaintttt = true
					this.showw = false
					this.page = false
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			carxi() {
				if (this.userr != undefined) {
					this.page = false;
					this.showw = false;
					this.mycar = true
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			// 删除银行卡
			delvalue() {
				console.log(this.bankvalue)
				console.log(this.mypwd)
				if (this.mybank != '') {
					if (this.mybank == this.bankvalue && this.mypwd == this.useracc && this.mybank != '' && this
						.bankvalue != '') {
						let that = this
						uni.request({
							url: "http://localhost:8000/didiupbank",
							data: {
								user: that.userr,
								value: that.upbank
							},
							method: 'GET',
							success: function(e) {
								uni.showModal({
									title: '删除成功',
									showCancel: false,
								});
								that.delmybank = false;
								that.useracc = ''
								that.bankvalue = ''
								that.centerrr();
								console.log(e.data.data, 999)
							},
							fail: function(err) {
								console.log(err)
							},
						})
					} else {
						uni.showModal({
							title: '不能为空或者银行卡不对或者用户密码不对',
							showCancel: false,
						});
					}
				} else {
					uni.showModal({
						title: '你没有银行卡删除不了',
						showCancel: false,
					});
				}
			},
			//银行卡提现
			recharge() {
				const intReg = /^[-+]?\d*$/
				if (this.mybank != '') {
					if (this.valuee != '' && this.valuee > 0 && this.valuee < 10000 && this.valuee <= this.mymoney &&
						intReg.test(this.valuee)) {
						let that = this
						uni.request({
							url: "http://localhost:8000/didimoney",
							data: {
								user: that.userr,
								value: that.valuee
							},
							method: 'GET',
							success: function(e) {
								that.upphone = false
								uni.showModal({
									title: '修改成功',
									showCancel: false,
								});

								// 插入提现表
								uni.request({
									url: "http://localhost:8000/didiinittx",
									data: {
										id: that.driverid,
										number: that.valuee
									},
									method: 'GET',
									success: function(e) {
										that.valuee = ''
									},
									fail: function(err) {
										console.log(err)
									},
								})
								that.centerrr();
							},
							fail: function(err) {
								console.log(err)
							},
						})
					} else {
						uni.showModal({
							title: '提现的值不能为空不能超过1万不能超过钱包里的值或者格式不对',
							showCancel: false,
						});
					}
				} else {
					uni.showModal({
						title: '还没有银行卡请去添加',
						showCancel: false,
					});
				}

			},
			//显示删除银行卡
			delbank() {
				if (this.intobank == false) {
					this.delmybank = true
				} else {
					console.log(1)
				}

			},
			//添加银行卡
			initvalue() {
				// console.log(this.mybank,382)
				// console.log(this.bankvalue,383)
				const yhkReg = /^([1-9]{1})(\d{11}|\d{15}|\d{16}|\d{17}|\d{18})$/
				if (this.mybank == '') {
					if (this.bankvalue != '' && yhkReg.test(this.bankvalue)) {
						console.log(this.bankvalue)
						let that = this
						uni.request({
							url: "http://localhost:8000/didibank",
							data: {
								user: that.userr,
								value: that.bankvalue
							},
							method: 'GET',
							success: function(e) {
								uni.showModal({
									title: '添加银行卡成功',
									showCancel: false,
								});
								that.intobank = false;
								that.bankvalue = ''
								that.centerrr();
								// console.log(e.data.data,999)
							},
							fail: function(err) {
								console.log(err)
							},
						})
					} else {
						uni.showModal({
							title: '输入的卡号不能为空或者格式不对',
							showCancel: false,
						});
					}
				} else {
					uni.showModal({
						title: '一个人只能添加一张银行卡',
						showCancel: false,
					});
					this.bankvalue = ''
					this.intobank = false;
				}


			},
			jiabank() {
				if (this.delmybank == false) {
					this.intobank = true;
				} else {
					console.log(1)
				}

			},
			yinh() {
				if (this.userr != undefined) {
					this.page = false;
					this.showw = false;
					this.bank = true;
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			//修改图片
			imgg() {
				console.log(this.fileList1, 11111)
				for (var i = 0; i < this.fileList1.length; i++) {
					this.tu = this.fileList1[i].url
					console.log(this.tu)
				}
				if (this.tu != '') {
					let that = this
					uni.request({
						url: "http://localhost:8000/didiupimg",
						data: {
							user: that.userr,
							img: that.tu
						},
						method: 'GET',
						success: function(e) {
							uni.showModal({
								title: '修改图片成功',
								showCancel: false,
							});
							that.fileList1 = ''
							that.tu = ''
							that.img = false;
							that.center = true;
							that.centerrr()
							console.log(e.data.data, 999)
						},
						fail: function(err) {
							console.log(err)
						},
					})
				} else {
					uni.showModal({
						title: '修改的图片不能为空',
						showCancel: false,
					});
				}

			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 mutiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
					})
				})
				console.log(this.fileList1, 999999999)
			},
			imggg() {
				if (this.uppwd == false && this.upphone == false) {
					this.img = true;
					this.showw = false;
					this.center = false;
				} else {
					console.log(1)
				}

			},
			cancel() {
				this.uppwd = false
			},
			centerr() {
				if (this.userr != undefined) {
					this.showw = false;
					this.page = false;
					this.center = true;
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			//
			qianbao() {
				if (this.userr != undefined) {
					this.page = false;
					this.showw = false;
					this.qian = true;
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			//退出登录
			tuichu() {
				console.log(1)
				uni.clearStorageSync('DriveruserTable');
				uni.clearStorageSync('toshu');
				uni.clearStorageSync('openid');
				// uni.switchTab({
				// 	url: '/pages/DriverLogin/DriverLogin'
				// });
				uni.showModal({
					title: '退出成功',
					showCancel: false,
				});
				uni.navigateTo({
					url: '/pages/DriverLogin/DriverLogin'
				});
			},
			//点击显示修改手机号码框
			updaphone() {
				if (this.uppwd == false) {
					this.upphone = true
				} else {
					console.log(1)
				}

			},
			//取消修改手机号
			cancelphone() {
				this.upphone = false
			},
			//修改手机号码
			updatephone() {
				const phoneReg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
				let that = this
				if (this.yzmvalues != '') {
					if (this.yzmvalues == this.yzm && this.phone != '' && this.phone == this.userr && this.xinphone !=
						'' && phoneReg.test(this.xinphone)) {
						if (this.phone != this.xinphone) {
							uni.request({
								url: "http://localhost:8000/didiupphone",
								data: {
									user: that.userr,
									phone: that.xinphone
								},
								method: 'GET',
								success: function(e) {
									// that.uppwd=false
									console.log(e.data.data, 999)
									for (var i = 0; i < that.pagelist.length; i++) {
										that.DriveruserTable = {
											userId: that.pagelist[i].driverId,
											userTel: that.xinphone,
											driverName: that.pagelist[i].driverName,
											driverPhoto: that.pagelist[i].driverPhoto,
											CreditPoints: that.pagelist[i].CreditPoints,
											driverName: that.pagelist[i].driverName,
										}
										uni.setStorageSync("DriveruserTable", that.DriveruserTable)
									}
									if (that.DriveruserTable != '') {
										that.centerrr()
										console.log(that.DriveruserTable, 953)
										that.userr = that.xinphone
										that.xinphone = ''
										that.upphone = false
										uni.showModal({
											title: '修改成功',
											showCancel: false,
										});
									} else {
										console.log(1)
									}


								},
								fail: function(err) {
									console.log(err)
								},
							})
						} else {
							uni.showModal({
								title: '修改后的手机号码不能跟原手机号码一样',
								showCancel: false,
							});
							this.xinphone = ''
						}
					} else {
						uni.showModal({
							title: '手机号错误或者新密码格式错误或者验证码错误',
							showCancel: false,
						});
						this.xinphone = ''
					}
				} else {
					uni.showModal({
						title: '验证码不能为空',
						showCancel: false,
					});
				}

			},
			updatepwd() {
				if (this.upphone == false) {
					this.uppwd = true
				} else {
					console.log(1)
				}

			},
			//  首页小贴士
			explain() {
				uni.navigateTo({
					url: '../explain/explain'
				})
			},
			//修改密码
			update() {
				const passwordReg = /(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{6,16}/
				let that = this
				if (this.acc == this.useracc && this.acc != '') {
					if (passwordReg.test(this.pwd)) {
						if (this.pwd == this.qrpwd && this.pwd != '' && this.qrpwd != '' && this.pwd != this.useracc) {
							uni.request({
								url: "http://localhost:8000/didiuppwd",
								data: {
									user: that.userr,
									pwd: that.pwd
								},
								method: 'GET',
								success: function(e) {
									that.upphone = false
									console.log(e.data.data, 999)
									uni.showModal({
										title: '修改成功',
										showCancel: false,
									});
									that.uppwd = false
									that.acc = ''
									that.pwd = ''
									that.qrpwd = ''
									that.centerrr()
								},
								fail: function(err) {
									console.log(err)
								},
							})
						} else {
							uni.showModal({
								title: '两次输入的密码不一样',
								showCancel: false,
							});
							that.acc = ''
							that.pwd = ''
							that.qrpwd = ''
						}
					} else {
						uni.showModal({
							title: '格式不对,密码最多16位最少6位',
							showCancel: false,
						});
						that.acc = ''
						that.pwd = ''
						that.qrpwd = ''
					}

				} else {
					uni.showModal({
						title: '原密码错误或者为空',
						showCancel: false,
					});
					that.acc = ''
					that.pwd = ''
					that.qrpwd = ''
				}
			},

			//取消修改
			orderr() {
				if (this.userr != undefined) {
					this.showw = false;
					this.order = true;
					this.page = false;
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
					});
				}

			},
			leftClick() {
				this.mycar = false
				this.upphone = false
				this.uppwd = false;
				this.intobank = false;
				this.delmybank = false;
				this.qian = false;
				this.showw = false;
				this.order = false;
				this.center = false;
				this.img = false;
				this.bank = false;
				this.page = true;
				this.complaintttt = false
				this.monetdebt = false
				this.mycomplaint = false
			},
			close() {
				this.showw = false
				this.mycomplaint = false
			},
			open() {

			},
			//查询个人中心
			centerrr() {
				this.aaaaaa = uni.getStorageSync('DriveruserTable')
				this.userr = this.aaaaaa.userTel
				console.log(this.userr, 123465)
				let that = this
				uni.request({
					url: "http://localhost:8000/didicontent",
					data: {
						user: that.userr
					},
					method: 'GET',
					success: function(e) {
						console.log(e.data.data, 999)
						that.pagelist = e.data.data
						for (var i = 0; i < that.pagelist.length; i++) {
							that.mybank = that.pagelist[i].bankCard
							that.mymoney = that.pagelist[i].money
							that.carId = that.pagelist[i].carId
							that.driverid = that.pagelist[i].driverId
						}
						uni.request({
							url: "http://localhost:8000/didiId",
							data: {
								id: that.driverid
							},
							method: 'GET',
							success: function(e) {
								that.driverlist = e.data.data
							},
							fail: function(err) {
								console.log(err)
							},
						})

						// 查插入表
						uni.request({
							url: "http://localhost:8000/didiwithdrawal",
							data: {
								id: that.driverid
							},
							method: 'GET',
							success: function(e) {
								console.log(e.data.data, 981981)
								that.withdrawallist = e.data.data
							},
							fail: function(err) {
								console.log(err)
							},
						})


						// 查投诉
						console.log(that.driverid, 1323)
						uni.request({
							url: "http://localhost:8000/complaintss",
							data: {
								id: that.driverid,
							},
							method: 'GET',
							success: function(e) {
								that.totos = e.data.data
								console.log(e.data.data, 1330)
							},
							fail: function(err) {
								console.log(err)
							},
						})
					},
					fail: function(err) {
						console.log(err)
					},
				})


				//查询车辆信息
				uni.request({
					url: "http://localhost:8000/didicarss",
					data: {
						user: that.userr
					},
					method: 'GET',
					success: function(e) {
						that.carlist = e.data.data
					},
					fail: function(err) {
						console.log(err)
					},
				})

				//查询我的评价

				uni.request({
					url: "http://localhost:8000/didipj",
					data: {
						id: that.aaaaaa.userId
					},
					method: 'GET',
					success: function(e) {
						// console.log(e.data.data,935935935)
						that.userlist = e.data.data
					},
					fail: function(err) {
						console.log(err)
					},
				})




			},
			// 模式
			pattern: function() {
				console.log(2)
				this.show = true
			},
			// 个人中心
			personal: function() {
				this.showw = true
			},
			// 模式切换
			patternCut: function(e) {
				this.show = false,
					this.present = e.value[0]
			},
			// 出车
			async pop_Up() {

				if (this.present == "快车") {
					// 判断 信誉分等于 0---提醒司机
					let CreditPoints = uni.getStorageSync('DriveruserTable').CreditPoints
					if (CreditPoints <= 0) return console.log('信誉分太低，不能接单')
					const driverInfo = uni.getStorageSync('DriveruserTable')
					// 获取司机的车牌号
					const result = await this.$http('/driverCarNum', {
						userID: driverInfo.userId
					})
					console.log(result, 1452)
					if (result.code !== 200) return console.log('查询车牌号出错')
					driverInfo.CarNum = result.CarNum

					// 存缓存
					uni.setStorageSync('DriveruserTable', driverInfo)

					uni.navigateTo({
						url: '/pages/FlashGet/FlashGet'
					})
				} else if (this.present == "出租车") {
					uni.navigateTo({
						url: '../Taxi/Taxi'
					})
				} else {
					uni.showToast({
						title: '请选择模式',
						icon: 'error',
						duration: 2000
					})
				}
			},
			
		},
		filters: {
			hideMiddle(val) {
				return `${val.substring(0,3)}*************${val.substring(val.length-3)}`
			}
		},
		onLoad() {
			this.myinfo()
			this.centerrr()
			this.query()
		}
	}
</script>

<style lang="scss">
	.content button {
		width: 100px;
		height: 40px;
	}

	//修改密码边框
	#app {
		width: 180px;
		border-radius: 6px;
		border: 1px solid white;
		margin-top: 20px;
		height: 20px;
		padding-left: 10px;
	}

	//钱包
	.content {
		position: absolute;
		top: 190px;
		left: 20px;
		border: 1px solid rebeccapurple;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 260px;
		width: 90%;
		background-image: url(../../static/zhuzi.webp);
	}

	// 服务数据
	.service_data {
		display: flex;
		width: 90%;
		margin: 0 auto;
		margin-top: 30px;

		.service_data_text {
			flex: 1;
			text-align: center;

			.service_data_text_num {
				font-size: 20px;
				font-weight: 700;
			}
		}
	}

	// 功能按钮
	.function {
		width: 90%;
		margin: 0 auto;
		display: flex;
		Justify-content: space-around;
		margin-top: 30px;

		.function_btn {
			width: 23%;
		}
	}

	// 底部按钮
	.bottom_btn {
		width: 100%;
		height: 60px;
		display: flex;
		Justify-content: center;
		Align-items: center;
		position: absolute;
		bottom: 20px;
		background-color: rgb(62, 65, 83);

		.btn_pattern {
			width: 200rpx;
			margin-right: 10px;
		}

		.btn_depart {
			width: 500rpx;
		}
	}

	// 中间内容
	.promote {
		width: 700rpx;
		height: 150px;
		margin: 0 auto;
		margin-top: 20px;
		border: 1px solid rgb(181, 181, 181);
		border-radius: 10px;
		background-color: white;

		.promote_title {
			width: 100%;
			height: 100px;
			border-bottom: 1px solid rgb(242, 242, 242);
			display: flex;

			.promote_img {
				margin-left: 20px;
				margin-top: 15px;
			}

			.promote_text {
				width: 100%;
				height: 100%;
				text-align: center;
				line-height: 45px;
			}

		}

		.promote_skip {
			width: 90%;
			height: 50px;
			margin: 0 auto;
			display: flex;
			Justify-content: space-between;
			Align-items: center;
			font-weight: 700;
		}
	}

	.aa {
		width: 100%;
		height: 250px;
		background: royalblue;
		position: absolute;
	}

	.bb {
		width: 90%;
		height: 200px;
		background:
			-webkit-linear-gradient(top, #ffffff, #d3d2d2);
		text-align: center;

		position: absolute;
		left: 15px;
		top: 130px;
		border-radius: 25px;
	}
</style>
